package cn.itcast.haoke.dubbo.api.controller;

import cn.itcast.haoke.dubbo.api.service.PicUploadFileSystemService;
import cn.itcast.haoke.dubbo.api.service.PicUploadService;
import cn.itcast.haoke.dubbo.api.vo.PicUploadResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
/**
 * @author GaoLeiLei
 * @version 1.0
 * @Title: 文件上传
 * @Description:
 * @Copyright: Copyright (c) 2019
 * @date 2019/11/2
 */
@RequestMapping("pic/upload")
@Controller
public class PicUploadController {

    //文件上传OSS Service
    /*@Autowired
    private PicUploadService picUploadService;*/

    //本地文件上传 Service
    @Autowired
    private PicUploadFileSystemService picUploadFileSystemService;

    /**
     * @author GaoLeiLei
     * @version 1.0
     * @Title 文件上传方法
     * @date 2019/11/2
     */
    @PostMapping
    @ResponseBody
    public PicUploadResult upload(@RequestParam("file") MultipartFile multipartFile) {
        //return this.picUploadService.upload(multipartFile);
        return  this.picUploadFileSystemService.upload(multipartFile);
    }
}
